﻿@using Microsoft.AspNetCore.Identity.EntityFrameworkCore;

@model IEnumerable<IdentityRole>
@{
    ViewData["Title"] = "新建角色";
}

<form asp-area="Admin" asp-controller="User" asp-action="CreateRole" method="post" class="form-horizontal">
    <hr />
    <div asp-validation-summary="All" class="text-danger"></div>
    <div class="form-group">
        <span class="col-md-2 control-label">角色名</span>
        <div class="col-md-4">
            <input name="Name" class="form-control" />
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <button type="submit" class="btn btn-default col-md-2">创建</button>
        </div>
    </div>
</form>

<div id="sections" class="panel panel-default">
    <div class="panel-heading">角色列表</div>
    <div class="panel-body">
        <div class="table-responsive">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>
                            角色
                        </th>
                        <th class="col-lg-1"></th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model)
            {
                        <tr>
                            <td>
                                @item.Name
                            </td>
                            <td><a asp-action="DeleteRole" asp-route-id="@item.Id" onclick="javascript:if(confirm('确定要删除此信息吗？')){return true;}return false;">删除</a></td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    </div>
</div>
    @section Scripts {
        @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
    }
